home *** CD-ROM | disk | FTP | other *** search
- Path: news.trs-p.co.jp.!sat!sat
- From: sat@trs-p.co.jp (Ogura Satoru)
- Newsgroups: comp.lang.c++
- Subject: Re: Copy commands - copy Binary files.
- Date: Fri, 05 Jan 1996 19:20:58 +0900
- Organization: T.R.S. Planning Inc., Tokyo.
- Message-ID: <sat-0501961920580001@sat.trs-p.co.jp>
- References: <peterf.54.000F9B13@gears.efn.org>
- NNTP-Posting-Host: sat.trs-p.co.jp
- Mime-Version: 1.0
- Content-Type: text/plain; charset=iso-2022-jp
-
- Hi,
-
- I suppose the file this program created has extra 0xff at the end,
- because the function feof() returns TRUE after you have read the EOF.
-
- > while (!feof(in))
- > { fputc(fgetc(in), out); }
- >
-
- int c;
- while ( ( c = fgetc( in ) ) != EOF ) {
- fputc( c, out );
- }
-
- will work correctly.
-
-
- I suppose you wonder why feof() doesn't return TRUE when no data is
- available to read.
- If the FILE is assigned to TERMINAL or PIPE, no data isn't always EOF.
-
-
- -------------
- Thank you!
- Satoru Ogura. T.R.S.Planning Inc., Tokyo
- sat@trs-p.co.jp
- -------------
-